package o;

import com.huawei.hwid.core.constants.HwAccountConstants;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import org.jsoup.nodes.Element;

abstract class gcn extends gck {
    final ArrayList<gck> ˊ;
    int ˋ;

    static final class b extends gcn {
        b(Collection<gck> collection) {
            if (this.ˋ > 1) {
                this.ˊ.add(new d((Collection) collection));
            } else {
                this.ˊ.addAll(collection);
            }
            ˎ();
        }

        b(gck... o_gckArr) {
            this(Arrays.asList(o_gckArr));
        }

        b() {
        }

        public void ˏ(gck o_gck) {
            this.ˊ.add(o_gck);
            ˎ();
        }

        public boolean ˎ(Element element, Element element2) {
            for (int i = 0; i < this.ˋ; i++) {
                if (((gck) this.ˊ.get(i)).ˎ(element, element2)) {
                    return true;
                }
            }
            return false;
        }

        public String toString() {
            return gbk.ˎ(this.ˊ, ", ");
        }
    }

    static final class d extends gcn {
        d(Collection<gck> collection) {
            super(collection);
        }

        d(gck... o_gckArr) {
            this(Arrays.asList(o_gckArr));
        }

        public boolean ˎ(Element element, Element element2) {
            for (int i = 0; i < this.ˋ; i++) {
                if (!((gck) this.ˊ.get(i)).ˎ(element, element2)) {
                    return false;
                }
            }
            return true;
        }

        public String toString() {
            return gbk.ˎ(this.ˊ, HwAccountConstants.BLANK);
        }
    }

    gcn() {
        this.ˋ = 0;
        this.ˊ = new ArrayList();
    }

    gcn(Collection<gck> collection) {
        this();
        this.ˊ.addAll(collection);
        ˎ();
    }

    gck ˊ() {
        return this.ˋ > 0 ? (gck) this.ˊ.get(this.ˋ - 1) : null;
    }

    void ˋ(gck o_gck) {
        this.ˊ.set(this.ˋ - 1, o_gck);
    }

    void ˎ() {
        this.ˋ = this.ˊ.size();
    }
}
